package com.wl.willChat.ui.login.activity

import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
import androidx.databinding.DataBindingUtil
import com.wl.willChat.R
import com.wl.willChat.base.BaseActivity
import com.wl.willChat.databinding.ActivityLoginBinding

class LoginActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val  binding= DataBindingUtil.setContentView<ActivityLoginBinding>(this,R.layout.activity_login)
        binding.login.setOnClickListener {
            if (binding.username!=null&&!"".equals(binding.username.text)){

            }else{

            }
        }

    }

    override fun getLayoutId(): Int {
        TODO("Not yet implemented")
    }

    override fun init(savedInstanceState: Bundle?) {
        TODO("Not yet implemented")
    }

}

fun EditText.afterTextChanged(afterTextChanged: (String) -> Unit) {
    this.addTextChangedListener(object : TextWatcher {
        override fun afterTextChanged(editable: Editable?) {
            afterTextChanged.invoke(editable.toString())
        }

        override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}

        override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
    })
}